package com.hngy.educationaladministration.utils;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Date;

/**
 * @author Deng JunHao
 * @date 2021/05/20 10:34
 * @description：
 **/
public class DateUtils {
    public static String dateToDateTimeFormatter(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(date);
    }

    public static String newTime() {
        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG);
        LocalDateTime now = LocalDateTime.now();
        return dateTimeFormatter1.format(now);
    }

    /**
     * 获取目前日期
     *
     * @return
     */
    public static String getNowDate() {
        return LocalDate.now().toString();
    }
}
